<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        // 1. 回调函数
        // 2. promise
        // 3. *函数
        // 4. async


        function* fn() { 
            // yield 暂停
            yield console.log(123)
            yield console.log(456)
            
            return console.log(789)
        }

        let MyFn = fn()
        // console.log(MyFn.next())
        // console.log(MyFn.next())
        // console.log(MyFn.next())

        function run () {
            if (MyFn.next().done === false) {
                MyFn.next()
                run()
            } else {
                return
            }
        }

        run()
    </script>
</body>
</html>